﻿using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public enum Environment
{
    Editor,//编辑器环境
    Editor_Art,//美术使用，不包含源码
    Android_Dev,
    Android_Release,
    Ios_Dev,
    Ios_Release,
    WxMiniGame_Dev,
    WxMiniGame_Release,
}

[CreateAssetMenu(menuName = "Config/ProjectEnvironment")]
public class ProjectEnvironment : ScriptableObject
{
    public Environment env = Environment.Editor;

#if UNITY_EDITOR
    public static void ChangeEnv(Environment env)
    {
        var guids = AssetDatabase.FindAssets($"{typeof(ProjectEnvironment)}");
        var path = AssetDatabase.GUIDToAssetPath(guids[0]);
        var config = AssetDatabase.LoadAssetAtPath<ProjectEnvironment>(path);
        config.env = env;
        EditorUtility.SetDirty(config);
        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
    }
#endif
}
